<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
    <title>详细页</title>
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <style>
        body {
            margin: 10px;
        }
    </style>
</head>
<body>

<form class="layui-form">

    <div class="layui-form-item">
        <label class="layui-form-label">title</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="" placeholder="title" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">Content</label>
        <div class="layui-input-block">
            <textarea name="content" id="content" placeholder="请输入内容" style="height: 400px;" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">keyValues</label>
        <div class="layui-input-block">
            <textarea name="keyValues" id="keyValues" placeholder="keyValues" class="layui-textarea"></textarea>
        </div>
    </div>


    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">category</label>
        <div class="layui-input-block">
            <input type="text" name="category01" placeholder="category01" autocomplete="off" class="layui-input">
            <input type="text" name="category02" placeholder="category02" autocomplete="off" class="layui-input">
            <input type="text" name="category03" placeholder="category03" autocomplete="off" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">categoryNum</label>
        <div class="layui-input-block">
            <input type="text" name="categoryNum" placeholder="categoryNum" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">Sortx</label>
        <div class="layui-input-block">
            <input type="text" name="sortx" lay-verify="" placeholder="排序" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-inline">
        <label class="layui-form-label">busDate</label>
        <div class="layui-input-inline">
            <input type="text" name="busDate" class="layui-input" id="busDate" placeholder="yyyy-MM-dd HH:mm:ss">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">Type</label>

        <div class="layui-inline">
            <div class="layui-input-inline">
                <select name="typesss"  lay-search="" id="type">
                    <option value="待定">待定</option>
                </select>
            </div>
        </div>
    </div>



    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">descmap</label>
        <div class="layui-input-block">
            <textarea name="descmap" id="descmap" placeholder="descmap" class="layui-textarea"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">version</label>
        <div class="layui-input-block">
            <input type="text" name="version" placeholder="version" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">parent_id</label>
        <div class="layui-input-block">
            <input type="text" name="parent_id" placeholder="parent_id" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="submitBtn" id="layuiadmin-app-form-submit" hidden>立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script src="/layuiadmin/layui/layui.js"></script>
<!--<script src="/layui/js/jquery.min.js?t=1237720346170"></script>-->

<script>
    //初始化
    $(function () {
        var jsonObj = parent.toEdit;
        for (var item in jsonObj) {
            var jValue = jsonObj[item];//key所对应的value
            $("input[name='" + item + "']").val(jValue);
            $("#" + item).val(jValue);
        }
    })


    layui.use(['form','laydate'], function () {
        var laydate = layui.laydate;
        var form = layui.form;

        laydate.render({
            elem: '#busDate'
            ,type: 'datetime'
            ,format: 'yyyy-MM-ddTHH:mm:ss' //可任意组合yyyy-MM-dd HH:mm:ss
        });
        //监听提交
        form.on('submit(submitBtn)', function (data) {

            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            //$.ajax({});成功后，关闭当前弹层并重载表格
            var fdata=JSON.stringify(data.field);
            if (parent.isadd) {
                parent.addData(fdata)
            } else {
                data.field.id = parent.toEdit.id;
                parent.updData(fdata, parent.toEdit.id)
            }
            // parent.reFresh();
            parent.layer.close(index); //再执行关闭
            return false;
        });
    });
</script>

</body>
</html>
